package main;

import heap.ReplacementHeap;
import io.CreateRandomArray;

import java.io.File;

public class Main {

	public static void main(String[] args) {
		CreateRandomArray.createFile(1000, "input.txt");

		int heapSize = 10;
		ReplacementHeap rh = new ReplacementHeap(heapSize);
		rh.buildInput(new File("input.txt"));
		// test();
		testPercolateDown(rh);
	}

	private static void testPercolateDown(ReplacementHeap rh) {

		rh.run();
	}

	public static void test() {
		int heapSize = 5;
		ReplacementHeap rh = new ReplacementHeap(heapSize);
		rh.buildInput(new File("input.txt"));

		int[] th = rh.test();
		for (int i = 0; i < 5; i++) {
			System.out.print(th[i] + "\t");
		}
		System.out.println();
		rh.buildHeap();
		th = rh.getHeap();
		for (int i = 0; i < 5; i++) {
			System.out.print(th[i] + "\t");
		}
	}

}
